package com.yxjx.duoxue.payment;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

import com.yxjx.duoxue.datamodel.DMObject;
import com.yxjx.duoxue.utils.UIHelper;

public class ClientUserKidsDTS extends DMObject implements Serializable {
    /**
	 * 
	 */
	private static final long serialVersionUID = 1824075962454698780L;
	//子女姓名
    private String kidsName;
    //子女年龄
    private Integer kidsAge;
    //子女性别 1-男，2-女
    private Integer kidsSex;
    //子女特点（逗号分隔的id字符串）
    private String kidsDetail;
    //子女出生年
    private Integer kidsBirthYear;
    public Integer getKidsBirthYear() {
		return kidsBirthYear;
	}

	public void setKidsBirthYear(Integer kidsBirthYear) {
		this.kidsBirthYear = kidsBirthYear;
	}

	public Integer getKidsBirthMonth() {
		return kidsBirthMonth;
	}

	public void setKidsBirthMonth(Integer kidsBirthMonth) {
		this.kidsBirthMonth = kidsBirthMonth;
	}

	public Integer getKidsBirthDay() {
		return kidsBirthDay;
	}

	public void setKidsBirthDay(Integer kidsBirthDay) {
		this.kidsBirthDay = kidsBirthDay;
	}

	public String getCourseType() {
		return courseType;
	}

	public void setCourseType(String courseType) {
		this.courseType = courseType;
	}

	//子女出生月
    private Integer kidsBirthMonth;
    //子女出生日
    private Integer kidsBirthDay;
    //子女兴趣课程
    private String courseType;

    public String getKidsName() {
        return kidsName;
    }

    public void setKidsName(String kidsName) {
        this.kidsName = kidsName;
    }

    public Integer getKidsAge() {
        return kidsAge;
    }

    public void setKidsAge(Integer kidsAge) {
        this.kidsAge = kidsAge;
    }

    public Integer getKidsSex() {
        return kidsSex;
    }

    public void setKidsSex(Integer kidsSex) {
        this.kidsSex = kidsSex;
    }

    public String getKidsDetail() {
        return kidsDetail;
    }

    public void setKidsDetail(String kidsDetail) {
        this.kidsDetail = kidsDetail;
    }

    @Override
    public String toString() {
        return "{\"kidsName\":\"" + kidsName 
        		+ "\", \"kidsDetail\":\"" + kidsDetail 
        		+ "\", \"courseType\":\"" + courseType 
        		+ "\", \"kidsBirthDay\":\"" + kidsBirthDay 
        		+ "\", \"kidsBirthMonth\":\"" + kidsBirthMonth 
        		+ "\", \"kidsBirthYear\":\"" + kidsBirthYear 
        		+ "\", \"kidsSex\":\"" + kidsSex 
        		+ "\", \"kidsDetail\":\"" + kidsDetail + "\"}";
    }
    
    /**
     * json str 2 object
     * @param str
     * @return
     */
    public static ClientUserKidsDTS from(String str) {
    	if (UIHelper.isEmpty(str)) {
    		return null;
    	}
    	
    	try {
			JSONObject jo = new JSONObject(str);
			ClientUserKidsDTS item = new ClientUserKidsDTS();
			item.setKidsAge(getInteger(jo, "kidsAge"));
			item.setKidsSex(getInteger(jo,"kidsSex"));
			item.setKidsDetail(getString(jo,"kidsDetail"));
			item.setKidsName(getString(jo,"kidsName"));
			item.setCourseType(getString(jo,"courseType"));
			item.setKidsBirthDay(getInteger(jo,"kidsBirthDay"));
			item.setKidsBirthMonth(getInteger(jo,"kidsBirthMonth"));
			item.setKidsBirthYear(getInteger(jo,"kidsBirthYear"));
			return item;
		} catch (JSONException e) {
			e.printStackTrace();
		}
    	
    	return null;
    }


}
